package com.demo.configuration;

import com.demo.interceptors.SessionInterceptors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class SessionConfiguration extends WebMvcConfigurerAdapter {

    private static final Logger logger = LoggerFactory.getLogger(SessionConfiguration.class);

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        logger.info("注册了SessionInterceptors");
        HandlerInterceptor sessionInterceptors = new SessionInterceptors();
        registry.addInterceptor(sessionInterceptors).addPathPatterns("/**");
    }
}
